import {
  snxd,
  img,
  cmslib
} from '@/config/env'
import {
  getPageParam
} from '@/config/utils'
import * as model from '@/config/homeModel.json'

export const getters = {
  homePage: state => {
    return state.homePage
  },
  homeNav: state => {
    return state.homeNav
  },
  homeContent: (state) => {
    let getMsg = []
    let content = state.homeContent
    for (var i in content) {
        let name = model[content[i].modelCode]
        let data = content[i].modelList
        getMsg.push({
          'name': name,
          'data': data,
          'show': true
        })
      }
    return getMsg
  },
  homeNotice: state => {
    return state.homeNotice
  },
  homePageUrl: state => {
    let url = state.homePage.homePageUrl
    if (url) {
      return getPageParam(url)
    } else {
      return ''
    }
  },
  homeNavUrl: state => {
    let url = state.homePage.bulletinUrl
    if (url) {
      return getPageParam(url)
    } else {
      return ''
    }
  },
  homeContentUrl: state => {
    return state.indextag
  },
  indextag: state => {
    return state.indextag
  },
  indexNotice: state => {
    return state.indexNotice
  },
  show_flashSale: state => {
    return state.show_flashSale
  },
  show_timeTitle: state => {
    return state.show_timeTitle
  }
}
